<template>
  <DataList :cate="cate" :cols="cols" :single="true" :name="name"/>
</template>
<script>
import DataList from "@/components/DataList";
import { getUser } from "@/utils/auth";
import { addJfzcmx3,deleteJfzcmx3,updateJfzcmx3,getJfzcmx3} from "@/api/其他支出.js";
export default {
  components: {
    DataList
  },
  data() {
    return {
      cate: "A5-2-3其他支出",
      name:'5.2.3 其他支出',
      cols: [
        { label: "征地(万元)", prop: "ZDJF" },
        { label: "基础设施建设(万元)", prop: "JCSSJSJF" },
        {
          label: "设备采购(万元)",
          prop: "设备采购",
          data: [
            { label: "合计", prop: "SBCGF" },
            {
              label: "其中:教学科研仪器设备值",
              prop: "JXKYYQSBCGF"
            }
          ]
        },
        {
          label: "日常教学经费(万元)",
          prop: "日常教学经费",
          data: [
            { label: "合计", prop: "RCJXJF" },
            {
              label: "其中",
              prop: "日常教学经费_其中",
              data: [
                { label: "实(验)训耗材", prop: "SYXHCJF" },
                { label: "实习专项", prop: "SXZXJF" },
                { label: "聘请兼职教师经费", prop: "PQJZJSJF" },
                { label: "体育维持费", prop: "TYWCF" },
                { label: "其他", prop: "QTRCJXJF" }
              ]
            }
          ]
        },
        { label: "图书购置费(万元)", prop: "TSGZF" },
        { label: "其他支出总额(万元)", prop: "QTZCZE" },
        { label: "还贷金额(万元)", prop: "HDJE" }
      ]
    };
  },
  methods: {
     
    async fetchData() {
      var user = getUser();
      var datas = await getJfzcmx3(user.XXID,user.CJPC);
      return datas;
    },
    async onChange(model, field, value){
    
      model.RCJXJF = Number(model.SYXHCJF)+Number(model.SXZXJF)+Number(model.PQJZJSJF)+Number(model.TYWCF)+Number(model.QTRCJXJF);
    },
    onadd(model) {
      //
      var temp = JSON.parse(JSON.stringify(model))
      return new Promise(async (resolve,reject)=>{
           
      
          console.log(JSON.stringify(temp));
          var model = await addJfzcmx3(temp);
          resolve(model);
      })
      
    },
    onupdate(model) {
      //
      var temp = JSON.parse(JSON.stringify(model))
      return new Promise(async (resolve,reject)=>{
           
          console.log(JSON.stringify(temp));
          var model = await updateJfzcmx3(temp);
          resolve(model);
      })
      //
    },
    ondelete(model) {
       var temp = JSON.parse(JSON.stringify(model))
      return new Promise(async (resolve,reject)=>{
        
         await deleteJfzcmx3(temp);
          resolve();
      })
    }
  }
};
</script>
<style>
</style>